1. Field of the Invention
The present invention relates to a communication apparatus, a communication control method and a storage medium, and more particularly, to a method for controlling a process for changing communication speed.
2. Description of the Related Art
There is known a communication method of performing communication flow control using a window size (see, for example, Japanese Laid-Open Patent Publication (Kokai) No. 2004-064665). In this communication method, since a transmitting side (for example, a host computer (client computer)) can transmit data corresponding to a window size shown by a receiving side (for example, a printing apparatus) without an acknowledgement packet from the receiving side, the number of acknowledgements required can be suppressed. Therefore, communication efficiency can be improved by increasing the window size.
However, for example, in some connection-type communication methods using TCP (Transmission Control Protocol), when connection with a receiving side is established, a transmitting side starts transmission of print data immediately after the establishment, and the process normally ends as soon as the transmission of the print data ends. In this case, if the receiving side is in a state of not being able to receive the print data, the received print data is discarded on the receiving side. As a result, it seems to the user that the print data has disappeared because a sheet on which the print data is printed is not discharged from the receiving side though the process of transmitting the print data is successful.
As an example, FIG. 6A shows an example of a communication flow in a case where disappearance of print data may occur. Here, it is assumed that a window size of a printing apparatus, which is a receiving side, is 8 Kbytes, and that a host computer, which is a transmitting side, transmits print data with a size of 5 Kbytes to the printing apparatus. When the window size is larger than the print data size as described above, the host computer transmits the whole print data to the printing apparatus without waiting for an acknowledgement from the printing apparatus. Therefore, when the printing apparatus is in a printing-disabled state, disappearance of the print data occurs. It should be noted that, in FIG. 6A, “SYN”, “ACK” and “FIN” represent synchronization (a connection request), a reception acknowledgement and end of transmission, respectively.
In order to cope with this problem, there is proposed a data disappearance preventing function of, by uniformly reducing an initial window size with which a receiving side responds so that a transmitting side cannot transmit all print data at a time, preventing occurrence of disappearance of the print data (for example, see Japanese Patent No. 4324048). FIG. 6B shows an example of a communication flow in a case where an initial window size of a receiving side is set small. Here, it is assumed that, when the initial window size of a printing apparatus, which is the receiving side, is set to 1 Kbyte, a transmitting-side host computer transmits print data with a total size of 5 Kbytes to the printing apparatus.
In this case, when the printing apparatus is in a printing-disabled state, the host computer cannot transmit subsequent print data after the first 1 Kbyte to the printing apparatus and, therefore, enters in a state of waiting for a response from the printing apparatus. When the host computer receives a negative acknowledgement from the printing apparatus, a print data transmission error occurs, and the user can confirm that a transmission error has occurred. It should be noted that, in FIG. 6B, “SYN” and “ACK” represent the same as in FIG. 6A, and “RST” represents reset but has the same meaning as “negative acknowledgement” here.
There is also proposed a protocol stack equipped with an automatic receive-window tuning function in order to improve communication performance (see, for example, Japanese Laid-Open Patent Publication (Kokai) No. 05-232058). FIG. 7A shows an example of a communication flow of performing automatic tuning of a receive window. The automatic receive-window tuning function is a function of a receiving-side printing apparatus dynamically changing a window size according to a data transmission speed of a transmitting-side printing apparatus. Thus, as the host computer transmits data without delay, the receiving side gradually increases the window size, and, thereby, high-speed communication can be realized.
However, when the data disappearance preventing function described before is realized in a printing apparatus which adopts the automatic receive-window tuning function, there may be a case where print data reception performance in the printing apparatus decreases. FIG. 7B shows an example of a communication flow in the case where the reception performance decreases.
For example, in an environment with a lot of network traffic or a network environment where a transmitting side and a receiving side are physically far away from each other, the data transmission speed of the transmitting side seems to be slow when seen from the receiving side. Therefore, the receiving side judges that it is not necessary to further increase the window size and continues data reception without increasing the size from the initial window size. That is, because the initial window size is 1 Kbyte, and the window size is not changed, it is necessary to perform a total of one hundred times of transmission/reception when the transmitting side wants to transmit print data with a total of 100 Kbytes, and a lot of time is required for transmission/reception of the print data. In comparison, for example, if the automatic receive-window tuning function works, and the second and third window sizes are changed to 50 Kbytes and 500 Kbytes, respectively, transmission of the print data is completed by a total of three times of transmission/reception.
As described above, a conventional communication flow has a problem that decrease in reception performance may become remarkable when it is attempted to solve the data disappearance problem, and, on the other hand, the data disappearance problem becomes remarkable when the initial window size is increased in order to improve the reception performance.